﻿@model IEnumerable<Contoso.Domain.ViewModels.EnrollmentIndexData>

@{
    ViewBag.Title = "Enrollments";
}

<h2>Enrollments</h2> 

<p> 
    @Html.ActionLink("Create New", "Create") 
</p> 

@*@using (Html.BeginForm())
{
    <p>
        Find by name: @Html.TextBox("SearchString", ViewBag.CurrentFilter as string) &nbsp;
        <input type="submit" value="Search" /></p>
}*@

<div id="grid">

@{
    var grid = new WebGrid(Model, defaultSort:"CourseTitle");
}

@grid.GetHtml(
    tableStyle : "table",
    alternatingRowStyle : "alternate",
    selectedRowStyle: "selected",
    headerStyle : "header",    
    columns: grid.Columns(
        grid.Column(
            header:"", 
            format:@<text>@Html.ActionLink("Edit", "Edit", new { id=item.EnrollmentID })</text>
            ),
        grid.Column(
            header:"", 
            format:@<text>@Html.ActionLink("Delete", "Delete", new { id=item.EnrollmentID })</text>
            ),            
        grid.Column(
            header:"Number",
            columnName : "CourseID",
            format: @<text>@item.CourseID</text>
            ),
         grid.Column(
            header: "Course Title",
            columnName : "CourseTitle",
            format: @<text>@item.CourseTitle</text>
            ),    
         grid.Column(
            header: "Student",
            columnName : "FullName",
            format: @<text>@item.FullName</text>
            ), 
         grid.Column(
            header: "Grade",
            columnName : "Grade",
            format: @<text>@item.Grade</text>
            )                   
    )
)

</div>

